package ninja9.muzik.dao;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * FavoriteSinger entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "favorite_singer", catalog = "muzik")
public class FavoriteSinger implements java.io.Serializable {

	// Fields

	private FavoriteSingerId id;
	private User user;

	// Constructors

	/** default constructor */
	public FavoriteSinger() {
	}

	/** full constructor */
	public FavoriteSinger(FavoriteSingerId id, User user) {
		this.id = id;
		this.user = user;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "userId", column = @Column(name = "user_id", nullable = false)),
			@AttributeOverride(name = "singerId", column = @Column(name = "singer_id", nullable = false)) })
	public FavoriteSingerId getId() {
		return this.id;
	}

	public void setId(FavoriteSingerId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false, insertable = false, updatable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}